package ThreadDemo.BlockingQueue;

import java.util.concurrent.ArrayBlockingQueue;

public class Cooker extends Thread{
    private ArrayBlockingQueue<String> bq;
    public Cooker(ArrayBlockingQueue<String> bq) {
        this.bq = bq;
    }

    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep(100);
                bq.put("汉堡包");
                System.out.println("放一个汉堡包");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
